#!/bin/sh
# Runs Babel to generate interfaces for standard languages.

# Output directories must be different so the make file babel.make
# won't get overwritten.  The server (-sC) directory name was chosen
# for backwards compatibility.

# Note that the version of Babel run here should be consistent with
# the version of the runtime Babel which is used in compiled bHYPRE
# code.

# To use this, hypre should be configured --with-babel
# For Python, hypre should be configured --enable-shared

babel --version

babel --output-directory=bHYPRE --comment-local-only -sC Interfaces.idl
babel --output-directory=bHYPREClient-C --comment-local-only -cC Interfaces.idl
babel --output-directory=bHYPREClient-F --comment-local-only --include-referenced -cF77 Interfaces.idl
# babel --output-directory=bHYPREClient-F90 --comment-local-only --include-referenced -cF90 Interfaces.idl
babel --output-directory=bHYPREClient-CX --comment-local-only --include-referenced -cUC++ Interfaces.idl
babel --output-directory=bHYPREClient-P --comment-local-only --include-referenced -cPython Interfaces.idl
babel --output-directory=bHYPREClient-J --comment-local-only -cJava Interfaces.idl

# Notes:
# The --include-referenced argument copies a slew of Babel's sidl*.h files into the bHYPREClient*
# directory.  It is necessary for Fortran and C++.  So far I haven't seen anything which would require
# it in C and Python, but I am using this argument for Python anyway.

# temporary fix to bad doc comments...
cd bHYPREClient-C
for i in *.h;do emacs -batch $i -l $HOME/linear_solvers/babel/docfix.el -f save-buffer; done                                                                                                        
# This doc comment fix should be done by hand in bHYPREClient-C :
# In bHYPRE_SStructVariable_IOR.h, first change /* to /** .
# Then move the bHYPRE_SStructVariable__array definition to above the doc
# comment, so the comment will instead be associated with the enum.
